{% extends "dvaui/base.html" %}
{% load staticfiles %}

{% block page_content %}
<section class="content-header" style="padding-top:0px" xmlns="http://www.w3.org/1999/html">
<div class="row">
    <div class="box box-info">
        <div class="box-header">
            <h3>Token for REST API</h3>
        </div>
    </div>
</div>
</section>
<section class="content">
    <div class="row">
        <div class="col-lg-10 col-lg-offset-1">
            <div class="box box-primary">
                <div class="box-header with-border text-center">
                    <h4>Use this token with REST API for creating DVAPQL queries/processes and Regions/Tubes.</h4>
                    <h4>It is also required for GET & LIST methods if Authentication only mode is enabled.</h4>
                </div>
                <div class="box-body text-center">
                    <label for="username"><h4>Username</h4></label>
                    <input style="width:400px;margin: 10px auto;" class="form-control" name="username" value="{{ username }}" contenteditable="false" />
                    <label for="token"><h4>Token (use it in header e.g. "Authorization:Token {{ token.key }}")</h4></label>
                    <input style="width:400px;margin: 10px auto;" class="form-control" name="token" value="{{ token.key }}" contenteditable="false" />
                </div>
                <div class="box-footer text-center">
                    <form action="/expire_token" method="post">
                        {% csrf_token %}
                        <button type="submit" class="btn btn-danger" name="expire" value="1"><i class="fa fa-close"></i> Expire this token (This will stop all apps from working)</button>
                    </form>

                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}
{% block page_js%}
<script>
    $(document).ready(function() {
        InitializeTables();
    })
</script>
{% endblock %}
